﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using Quartz;
using Quartz.Impl;
using Quartz.Xml;
using QualityRpt;


namespace ETCQWs
{

    public partial class Auto_RPT : ServiceBase
    {
        private IScheduler scheduler;
        private static readonly log4net.ILog logger = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
        public Auto_RPT()
        {
            InitializeComponent();
            ISchedulerFactory schedulerFactory = new StdSchedulerFactory();
            scheduler = schedulerFactory.GetScheduler();
        }
        protected override void OnStart(string[] args)
        {
            scheduler.Start();
            logger.Info("任务调度已成功启动" + DateTime.Now);
        }

        protected override void OnStop()
        {
            scheduler.Shutdown();
            logger.Info("任务调度已停止" + DateTime.Now);
        }
        protected override void OnPause()
        {
            scheduler.PauseAll();
        }

        protected override void OnContinue()
        {
            scheduler.ResumeAll();
        }
    }
}
